<template>
   <button @click="modalOpen = true">打开一个对话框</button>
   <!--对话框代码-->
   <teleport to="body">
   <div v-if="modalOpen" class="modal">
        <div>这是对话框</div>
        <button @click="modalOpen = false">关闭</button>
   </div>
   </teleport>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue'
export default defineComponent({
    name: 'ModalBotton',
    setup() {
        // 控制对话框显示或隐藏的
        const modalOpen = ref(false)
        return {
            modalOpen
        }
    },
})
</script>
<style>
</style>